﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AdminPages_ViewFlaggedComments : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if(e.CommandName.Equals("deleteComment"))
        {
            TableCell CommentID = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0];

            DVDTableAdapters.FlaggedCommentTableAdapter ta = new DVDTableAdapters.FlaggedCommentTableAdapter();
            ta.DeleteQuery(Convert.ToInt32(CommentID.Text));
            
            DVDTableAdapters.CommentTableAdapter ta1 = new DVDTableAdapters.CommentTableAdapter();
            ta1.DeleteQuery(Convert.ToInt32(CommentID.Text));
        
        }
        else if (e.CommandName.Equals("unflagComment"))
        {
            TableCell CommentID = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0];
            
            DVDTableAdapters.FlaggedCommentTableAdapter ta = new DVDTableAdapters.FlaggedCommentTableAdapter();
            ta.DeleteQuery(Convert.ToInt32(CommentID.Text));

        }
        else if (e.CommandName.Equals("ViewCommentContext"))
        {
            TableCell CommentID = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0];
            TableCell MovieID = GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2];
            Response.Redirect("~/AdminPages/FlaggedCommentsContext.aspx?MovieID=" +Convert.ToInt32(MovieID.Text) +"&FlaggedID=" + Convert.ToInt32(CommentID.Text));

        
        }
    }
}